/**
 * Copyright 2008 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package kiff.enumerator;

/**
 * Topic Type Enumerator.
 * @author Adam
 * @version $Id: TopicType.java 38 2008-09-21 07:40:51Z a.ruggles $
 */
public enum TopicType implements GenericEnum<Byte> {
	/**
	 * Identifies the topic as an announcement.
	 */
	ANNOUNCEMENT((byte) 0, "Topic"),
	/**
	 * Identifies the topic as sticky.
	 */
	STICKY((byte) 1, "Sticky"),
	/**
	 * Identifies a generic topic.
	 */
	TOPIC((byte) 2, "Topic");

    /**
     * Returns a <code>Status</code> for a given byte value.
     * @param value The byte value.
     * @return A <code>Status</code>.
     */
	public static TopicType fromValue(final Byte value) {
		switch (value) {
		case 2: return TOPIC; // ordered first since this will most often be the value.
		case 1: return STICKY;
		case 0: return ANNOUNCEMENT;
		default: return TOPIC;
		}
	}

	/**
	 * Label.
     */
    private String label;

    /**
     * Byte value.
     */
    private byte value;

    /**
     * Constructor.
     * @param value The value.
     * @param label The label.
     */
    private TopicType(final Byte value, final String label) {
        this.value = value;
        this.label = label;
    }

    /**
     * Returns the label for this status (Used for displaying).
     * @return The label.
     */
    public String getLabel() {
        return label;
    }

    /**
     * Returns the byte value.
     * @return The byte value.
     */
    public Byte getValue() {
        return value; 
    }
}
